/**
 *
 */
package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.server.mapper.MemberRebateMapper;
import com.ybkj.daijia.server.model.MemberRebate;
import com.ybkj.daijia.server.service.MemberRebateService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Shine
 */
@Service
public class DefaultMemberRebateService implements MemberRebateService {

    @Autowired
    private MemberRebateMapper memberRebateMapper;


    @Transactional(rollbackFor = Exception.class)
    public MemberRebate save(MemberRebate memberRebate) {

        memberRebateMapper.insertRecord(memberRebate);

        return memberRebate;

    }

    @Transactional(rollbackFor = Exception.class)
    public void update(MemberRebate memberRebate) {

        memberRebateMapper.updateByPrimaryKey(memberRebate);

    }

    @Override
    public MemberRebate findOne(Long id) {
        return memberRebateMapper.selectByPrimaryKey(id);
    }


    @Override
    public List<MemberRebate> findAll() {
        return memberRebateMapper.selectAll();
    }

    @Override
    public MemberRebate findByCompany(Long companyId) {
        return memberRebateMapper.selectByCompany(companyId);
    }


}